from django.db import models
from django_countries import CountryField
from django.utils.translation import ugettext_lazy as _
from hvad.models import TranslatableModel, TranslatedFields

class NTitle( TranslatableModel):
    title  = models.CharField(_('ntitle'), help_text=_('National title '),max_length=512)
    country = CountryField(_('Country'), help_text=_("Country"))

    translations = TranslatedFields(
        description = models.TextField(),
        description_title  = models.CharField(_('ntitle'), help_text=_('National title '),max_length=512),
    )

    def __unicode__(self):
        return self.title

    class Meta:
        verbose_name = _('National title')
        verbose_name_plural = _('National title')

class ITitle( TranslatableModel):
    title  = models.CharField(_('ititle'), help_text=_('International title '),max_length=512)

    translations = TranslatedFields(
        description = models.TextField(),
        description_title  = models.CharField(_('ititle'), help_text=_('International title '),max_length=512),
    )

    def __unicode__(self):
        return self.title

    class Meta:
        verbose_name = _('International title')
        verbose_name_plural = _('International title')

class Player( TranslatableModel):
    fio = models.CharField(_('FIO'), help_text=_('First name, Second Name and Third name  '),max_length=512)
    federation = models.CharField(_('Federation'), help_text=_('Federation'), max_length=512)
    country = CountryField(_('Country'), help_text=_("Country"))
    birthday = models.DateField(_('Birthday'), help_text=_("Player's birthday"))
    ntitle = models.OneToOneField(NTitle, verbose_name=_("National title"))
    ititle = models.OneToOneField(ITitle, verbose_name = _("International title"))
    rate = models.IntegerField(_('Rate'), help_text=_("International Rate"))

    translations = TranslatedFields(
        description = models.TextField(),
        description_fio = models.CharField(_('FIO'), help_text=_('First name, Second Name and Third name  '),max_length=512),
        description_federation = models.CharField(_('Federation'), help_text=_('Federation'), max_length=512),
    )

    def __unicode__(self):
        return self.fio

    class Meta:
        verbose_name = _('Player')
        verbose_name_plural = _('Player')

